package com.ruoyi.jjyh.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.jjyh.mapper.JjyhGoodsreleaseMapper;
import com.ruoyi.jjyh.domain.JjyhGoodsrelease;
import com.ruoyi.jjyh.service.IJjyhGoodsreleaseService;
import com.ruoyi.common.core.text.Convert;

/**
 * 商品发布Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-11-20
 */
@Service
public class JjyhGoodsreleaseServiceImpl implements IJjyhGoodsreleaseService 
{
    @Autowired
    private JjyhGoodsreleaseMapper jjyhGoodsreleaseMapper;

    /**
     * 查询商品发布
     * 
     * @param id 商品发布ID
     * @return 商品发布
     */
    @Override
    public JjyhGoodsrelease selectJjyhGoodsreleaseById(String id)
    {
        return jjyhGoodsreleaseMapper.selectJjyhGoodsreleaseById(id);
    }

    @Override
    public JjyhGoodsrelease selectGoodsById(String id, String lat, String lon)
    {
        return jjyhGoodsreleaseMapper.selectGoodsById(id, lat, lon);
    }

    /**
     * 查询商品发布列表
     * 
     * @param jjyhGoodsrelease 商品发布
     * @return 商品发布
     */
    @Override
    public List<JjyhGoodsrelease> selectJjyhGoodsreleaseList(JjyhGoodsrelease jjyhGoodsrelease)
    {
        return jjyhGoodsreleaseMapper.selectJjyhGoodsreleaseList(jjyhGoodsrelease);
    }

    public List<JjyhGoodsrelease> selectGoodsList(Map<String, Object> map){
        return jjyhGoodsreleaseMapper.selectGoodsList(map);
    }

    public List<Map<String, Object>> selectUnit(){
        return jjyhGoodsreleaseMapper.selectUnit();
    }

    /**
     * 新增商品发布
     * 
     * @param jjyhGoodsrelease 商品发布
     * @return 结果
     */
    @Override
    public int insertJjyhGoodsrelease(JjyhGoodsrelease jjyhGoodsrelease)
    {
        jjyhGoodsrelease.setCreateTime(DateUtils.getNowDate());
        return jjyhGoodsreleaseMapper.insertJjyhGoodsrelease(jjyhGoodsrelease);
    }

    /**
     * 修改商品发布
     * 
     * @param jjyhGoodsrelease 商品发布
     * @return 结果
     */
    @Override
    public int updateJjyhGoodsrelease(JjyhGoodsrelease jjyhGoodsrelease)
    {
        jjyhGoodsrelease.setUpdateTime(DateUtils.getNowDate());
        return jjyhGoodsreleaseMapper.updateJjyhGoodsrelease(jjyhGoodsrelease);
    }

    /**
     * 删除商品发布对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteJjyhGoodsreleaseByIds(String ids)
    {
        return jjyhGoodsreleaseMapper.deleteJjyhGoodsreleaseByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除商品发布信息
     * 
     * @param id 商品发布ID
     * @return 结果
     */
    @Override
    public int deleteJjyhGoodsreleaseById(String id)
    {
        return jjyhGoodsreleaseMapper.deleteJjyhGoodsreleaseById(id);
    }
}
